//
//  HPTestData.m
//  Test-ZhuangHaiPeng
//
//  Created by Hai Peng Zhuang on 12/16/15.
//  Copyright © 2015 itcast. All rights reserved.
//

#import "HPTestData.h"

@implementation HPTestData

+ (NSMutableArray *)data
{
    NSArray *sourceArr=[NSArray arrayWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"test.plist" ofType:nil]];
    NSMutableArray *desArr=[NSMutableArray array];
    //循环遍历字典数组，字典转模型
    for (NSDictionary *dic in sourceArr) {
        //每一个字典对应着一个模型对象
        HPTestData *data=[HPTestData dataWithDic:dic];
        [desArr addObject:data];
    }
    return desArr;

}
+ (instancetype) dataWithDic:(NSDictionary *)dic
{
    return [[self alloc] initWithDic:dic];
}

- (instancetype) initWithDic:(NSDictionary *)dic
{
    if (self=[super init]) {
        [self setValuesForKeysWithDictionary:dic];
    }
    return self;
}


@end
